package model;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import controller.MisterJumpController;

public class Monster extends Platform
{
	
	private boolean alive = true;
	
	public Monster(double cX, double cY) throws SlickException
	{
		super(cX, cY);
		image = new Image("data/monster4.png");
		width = .1;
		height = .1;
		
	}
	
	public void act()
	{
		if (alive)
		{
			Wrapper model = Wrapper.getInstance();
			if (super.misterJumpsOn())
			{
				kill();
				model.setMisterYGeschwindigkeit(.02);
			}
			else if (MisterJumpController.collisionDetected(getX(), getY(), getWidth(), getHeight(), model.getMisterX(), model.getMisterY(), model.getMisterWidth(), model.getMisterHeight()))
			{
				model.killMister();
			}
		}
	}
	
	public void kill()
	{
		alive = false;
		image.setAlpha(0);
	}
	
}
